package cn.uestc.labhms.modules.hms.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import cn.uestc.labhms.modules.hms.entity.ColonoscopyPathologyRecordEntity;
import cn.uestc.labhms.modules.hms.service.ColonoscopyPathologyRecordService;
import cn.uestc.labhms.common.utils.PageUtils;
import cn.uestc.labhms.common.utils.R;



/**
 * 
 *
 * @author Mu.tz
 * @email Mutz@gmail.com
 * @date 2021-11-01 20:33:41
 */
@RestController
@RequestMapping("hms/colonoscopypathologyrecord")
public class ColonoscopyPathologyRecordController {
    @Autowired
    private ColonoscopyPathologyRecordService colonoscopyPathologyRecordService;

    /**
     * 列表
     */
    @RequestMapping("/list")
//    @RequiresPermissions("hms:colonoscopypathologyrecord:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = colonoscopyPathologyRecordService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{pathologyId}")
    @RequiresPermissions("hms:colonoscopypathologyrecord:info")
    public R info(@PathVariable("pathologyId") String pathologyId){
		ColonoscopyPathologyRecordEntity colonoscopyPathologyRecord = colonoscopyPathologyRecordService.getById(pathologyId);

        return R.ok().put("colonoscopyPathologyRecord", colonoscopyPathologyRecord);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("hms:colonoscopypathologyrecord:save")
    public R save(@RequestBody ColonoscopyPathologyRecordEntity colonoscopyPathologyRecord){
		colonoscopyPathologyRecordService.save(colonoscopyPathologyRecord);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("hms:colonoscopypathologyrecord:update")
    public R update(@RequestBody ColonoscopyPathologyRecordEntity colonoscopyPathologyRecord){
		colonoscopyPathologyRecordService.updateById(colonoscopyPathologyRecord);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("hms:colonoscopypathologyrecord:delete")
    public R delete(@RequestBody String[] pathologyIds){
		colonoscopyPathologyRecordService.removeByIds(Arrays.asList(pathologyIds));

        return R.ok();
    }

}
